<?php
/**
 * The following variables are available in this template:
 * - $this: the CrudCode object
 */
?>
<div class="form">

<?php echo "<?php \$form=\$this->beginWidget('CActiveForm', array(
	'id'=>'".$this->class2id($this->modelClass)."-form',
	'enableAjaxValidation'=>false,
//        'enableClientValidation' => true,
//        'clientOptions' => array(
//            'validateOnSubmit' => true,
//        ),
//        'htmlOptions' => array('enctype' => 'multipart/form-data')
)); ?>\n"; ?>

	<table class="button-form"><tr>
		<td><span class="note">Thông tin bắt buộc <span class="required">*</span>.</span></td>
		<td align="right">
			<div class="row buttons"><?php echo "<?php echo CHtml::submitButton(\$model->isNewRecord ? 'Đăng kí' : 'Cập nhật'); ?>" ?></div>
		</td>
	</tr></table>

	<?php /*echo "<?php echo \$form->errorSummary(\$model); ?>\n";*/ ?>

<?php
foreach($this->tableSchema->columns as $column)
{
	if($column->autoIncrement  || $column->name == 'id')
		continue;
?>

	<div class="row">
		<?php echo "<?php echo ".$this->generateActiveLabel($this->modelClass,$column)."; ?>\n"; ?>
		<?php if ($column->name == 'status') :?>
	<?php echo "<?php echo \$form->dropDownList(\$model,'status',Util::itemAlias('UserStatus')); ?>\n"; ?>
		<?php else :?>
	<?php echo "<?php echo ".$this->generateActiveField($this->modelClass,$column, '1')."; ?>\n"; ?>
		<?php endif?>
<?php echo "<?php echo \$form->error(\$model,'{$column->name}'); ?>\n"; ?>
	</div>
<?php
}
?>

        <?php echo "<?php if (!\$model->isNewRecord): ?>\n"; ?>
			<input type="hidden" name="update_id" value="<?php echo "<?php echo \$model->id; ?>"; ?>"/>
        <?php echo "<?php endif; ?>\n"; ?>

	<table class="button-form"><tr>
		<td align="right">
			<div class="row buttons"><?php echo "<?php echo CHtml::submitButton(\$model->isNewRecord ? 'Đăng kí' : 'Cập nhật'); ?>" ?></div>
		</td>
	</tr></table>

<?php echo "<?php \$this->endWidget(); ?>\n"; ?>

</div><!-- form -->